Skip to content

chore(factorio-cycle-calculator): Address the Comments#116

Merged
hcoona merged 1 commit intomainfrom
dev/shuaizhang/factorio-calculator
Feb 12, 2026
Merged

chore(factorio-cycle-calculator): Address the Comments#116
hcoona merged 1 commit intomainfrom
dev/shuaizhang/factorio-calculator

Conversation

@hcoona
Copy link
Owner

@hcoona hcoona commented Feb 12, 2026

No description provided.

Copilot AI review requested due to automatic review settings February 12, 2026 18:09
@hcoona hcoona force-pushed the dev/shuaizhang/factorio-calculator branch from 2841e43 to ac70967 Compare February 12, 2026 18:09
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the private Factorio cycle calculator app/scripts to incorporate prior review feedback: remove hard-coded local paths, improve robustness when parsing assets/data, and refine solver/productivity handling.

Changes:

  • Removed hard-coded local Factorio paths and shifted defaults toward env/user-provided inputs.
  • Added machine base_productivity support and included it in per-machine rate calculations.
  • Improved robustness/UX: safer icon loading, better error handling for invalid recipe chains, and __main__ guarding.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/private/app/factorio-cycle-calculator/app.py Removes hard-coded defaults, adds base productivity to machines, improves icon loading and solver validation, and adds if __name__ == "__main__" guard.
src/private/app/factorio-cycle-calculator/.AGENT/scripts/check_icons_and_locale.py Removes hard-coded defaults for data-raw path, supports env-based defaults, and tightens validation/arg handling.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@chatgpt-codex-connector
Copy link

💡 Codex Review

demand_pg_per_s = demand_pg_per_min / 60.0

P2 Badge Apply demand conversion using the selected rate unit

The solver always computes demand_pg_per_s as demand_pg_per_min / 60.0, so when users switch the UI to per second they still solve against a per-minute target while all displayed flows are per-second. In that mode, entering a target like 15 leads to solving for 0.25/s, which under-sizes machine counts by 60x; the conversion should follow the selected rate_unit (or the input should be explicitly fixed to per-minute only).


key: amount * multiplier / cycle_seconds
for key, amount in recipe.results.items()

P2 Badge Respect per-result productivity exclusions

per_machine_rates multiplies every recipe output by 1 + productivity, but Factorio supports outputs flagged ignored_by_productivity that must not be scaled. For recipes with catalyst/return outputs, this overstates produced amounts and skews the balance constraints and optimizer result; preserve per-result metadata and apply productivity only to eligible outputs.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@hcoona
Copy link
Owner Author

hcoona commented Feb 12, 2026

True positive on both points. Updated demand conversion to divide by the selected unit multiplier (per-min vs per-sec), and preserved per-result productivity exclusions by tracking ignored-by-productivity outputs and skipping the multiplier for those results.

@hcoona
Copy link
Owner Author

hcoona commented Feb 12, 2026

@codex review

@hcoona hcoona force-pushed the dev/shuaizhang/factorio-calculator branch from ac70967 to 8481887 Compare February 12, 2026 18:24
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

src/private/app/factorio-cycle-calculator/app.py:354

  • The direct float() conversion is unsafe for dynamically-typed data-raw fields. If base_effect.get("productivity") returns an unexpected type (e.g., dict or list), this will raise TypeError and crash catalog building. Use parse_effect_bonus() instead for consistent type coercion that handles edge cases gracefully.
        crafting_speed = float(proto.get("crafting_speed", 1.0))

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. Another round soon, please!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@hcoona hcoona merged commit 1a3d35f into main Feb 12, 2026
17 checks passed
@hcoona hcoona deleted the dev/shuaizhang/factorio-calculator branch February 12, 2026 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant